home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume3 / laserjet / part2 < prev    next >
Encoding:
Internet Message Format  |  1986-11-30  |  31.1 KB

  1. From: genrad!linus!philabs!ron1!ron (Ron Saad)
  2. Subject: HP LaserJet driver part 2 of 2.
  3. Newsgroups: mod.sources
  4. Approved: jpn@panda.UUCP
  5.  
  6. Mod.sources:  Volume 3, Issue 19
  7. Submitted by: philabs!ron1!ron (Ron Saad)
  8.  
  9.  
  10. #! /bin/sh
  11. # This is a shell archive, meaning:
  12. # 1. Remove everything above the #! /bin/sh line.
  13. # 2. Save the resulting text in a file.
  14. # 3. Execute the file with /bin/sh (not csh) to create the files:
  15. #    hp.c
  16. # This archive created: Mon Sep 23 23:09:35 1985
  17. export PATH; PATH=/bin:$PATH
  18. echo shar: extracting "'hp.c'" '(28471 characters)'
  19. if test -f 'hp.c'
  20. then
  21.     echo shar: will not over-write existing file "'hp.c'"
  22. else
  23. sed 's/^    X//' << \SHAR_EOF > 'hp.c'
  24.     X/* vi:se ts=4 sw=4 wm=0: */
  25.     Xstatic char *RCSid =
  26.     X        "$Header: hp.c,v 1.1.1.9 85/08/17 15:53:35 ron Exp $";
  27.     X
  28.     X/*
  29.     X * hp.c - Copyright (c) 1985 by Ron Saad (ron1!ron)
  30.     X * All Rights Reserved.
  31.     X *
  32.     X * This code maybe freely distributed in source
  33.     X * for non commercial purposes.
  34.     X * Please keep this notice intact.
  35.     X */
  36.     X
  37.     X/*
  38.     X * $Log:    hp.c,v $
  39.     X * Revision 1.1.1.9  85/08/17  15:53:35  ron
  40.     X * As usual, just 'one more thing ..' - moved the
  41.     X * size cheating code to where it belongs - just before
  42.     X * the file gets read in.
  43.     X * still to do:
  44.     X * make vgoto adjust the height to scale for not having a full
  45.     X * 11 inches, otherwise get bogus page feeds.
  46.     X * 
  47.     X * Revision 1.1.1.8  85/08/15  14:50:29  ron
  48.     X * this seems to be the version going out to mod.sources
  49.     X * (if they'll take it).
  50.     X * 
  51.     X * Revision 1.1.1.7  85/08/07  23:13:06  ron
  52.     X * this is probably a usable version of the laserjet driver. it loads
  53.     X * bit maps for special fonts and for sizes that are not on the cartridge,
  54.     X * and has the basis for enhancement - it still needs a LOT of work:
  55.     X * CLEANING UP!
  56.     X * recognition of vfont/rasti10 by f_magic - add field to FINFO
  57.     X *     and use to decide on height/width of character, positioning, etc.
  58.     X * add code tables for rasti10 bit maps.
  59.     X * etc
  60.     X * 
  61.     X * Revision 1.1.1.6  85/08/04  12:38:56  ron
  62.     X * added font info table, changed font reads to a fseek followed
  63.     X * by charater data reads. still need to add code tables for rasti10
  64.     X * and distinguish between rasti10 and vfont. add field to finfo based
  65.     X * on the f_magic and enforce f_magic. find out why vfont produces
  66.     X * poorly placed characters.
  67.     X * has not yet been tested.
  68.     X * 
  69.     X * Revision 1.1.1.5  85/08/02  14:08:40  ron
  70.     X * adding a font info table so that we can use more than
  71.     X * one bit-map at a time without constantly loading/unloading
  72.     X * files. may also change the loading to an fseek followed by a read to
  73.     X * minimize file access since most of the bit-map stuff are done
  74.     X * for only a few characters.
  75.     X * therefore keep this "pre-change" version b4 i destroy it ...
  76.     X * 
  77.     X * Revision 1.1.1.4  85/07/28  15:07:33  ron
  78.     X * works. is confined to one size - next step is size changes. rule
  79.     X * is done wrong - comes out too low - should use bit map.
  80.     X * knows about differences between vfont and rasti10 - i.e. adding
  81.     X * 1 bit and 1 row when needed.
  82.     X * 
  83.     X * Revision 1.1.1.3  85/07/21  16:28:51  ron
  84.     X * first attempt at adding the special font as a raster
  85.     X * map and dump'n out bit maps when appropriate.
  86.     X * 
  87.     X * Revision 1.1.1.2  85/07/19  12:24:15  ron
  88.     X * took out the 'optimization'. it does work, i.e. cuts file size,
  89.     X * imaging time etc, but the spacing of the laserjet is much larger
  90.     X * than what troff thinks it is.
  91.     X * 
  92.     X * Revision 1.1.1.1  85/07/10  10:26:06  ron
  93.     X * gave up on eliminating hpos for now. may try again
  94.     X * later.
  95.     X * 
  96.     X * Revision 1.1.0.2  85/07/10  08:38:59  ron
  97.     X * ok, put in a fudge to do hflush() only if it's not
  98.     X * a sequence of characters.
  99.     X * 
  100.     X * Revision 1.1.0.1  85/07/10  08:30:23  ron
  101.     X * the numbering in rcs is ridiculous. anyway, this is the 'starting'
  102.     X * file for this 'branch'. goal is to eliminate as many horiz position
  103.     X * as possible, since this takes forever on the laserjet. next try
  104.     X * is to let the printer do the spacing in every case where
  105.     X * we have just printed a sequence of 2hor-mot-digits+char and
  106.     X * have another one immediately following.
  107.     X * 
  108.     X * 
  109.     X */
  110.     X
  111.     X
  112.     X#include    <stdio.h>
  113.     X#include    <signal.h>
  114.     X#include    <ctype.h>
  115.     X#include    <strings.h>
  116.     X
  117.     X#include "glyph.h"
  118.     X#include "asctab.h"
  119.     X#include "spectab.h"
  120.     X
  121.     Xint    output    = 0;    /* do we do output at all? */
  122.     Xint    pgindex    = 0;    /* output page list if > 0 */
  123.     Xint    pagelist[20];    /* pairs of page numbers */
  124.     X
  125.     X
  126.     X
  127.     X#define    FATAL    1
  128.     Xint    dbg    = 0;
  129.     X
  130.     X#define    dprintf    if (dbg) fprintf
  131.     X#define    dinfoprint    if (dbg) finfoprint
  132.     X
  133.     Xint    res    = 720;
  134.     X    /* input assumed computed according */
  135.     X    /* to this resolution (actually 723) */
  136.     X    /* initial value to avoid 0 divide */
  137.     X
  138.     Xchar    *dfltdir    = "/usr/lib/vfont";
  139.     X
  140.     Xchar    *fontdir    = "/usr/lib/font";
  141.     Xchar    *vfontdir    = "/usr/lib/vfont";
  142.     Xchar    *rfontdir    = "/usr/src/cmd/text/troff.d/devi10/rasti10";
  143.     X
  144.     Xextern char devname[];
  145.     X
  146.     Xint    want_siz = 10;    /* convenient defaults */
  147.     Xint    crnt_siz = 10;
  148.     X
  149.     Xint    c_fnt_indx = 0;
  150.     Xint cartridge = 1;
  151.     X
  152.     X#define    NUMFONTS    8
  153.     X
  154.     X/*
  155.     X * the purpose for this array is to have more than one size
  156.     X * of a font available at a time. this is not handled properly now,
  157.     X * the entry is just replaced, causing some unnecessary i/o to
  158.     X * take place. when it's done correctly, the character info structures
  159.     X * will only need to be read once and this thing will work faster.
  160.     X * (it will never be fast - the laserjet is too slow in processing
  161.     X * the positioning commands/bit maps to be REALLY useful).
  162.     X * Also, presently, the c_fnt_indx always corresponds to the font
  163.     X * position used. The inclusion of f_numb field is to make this 
  164.     X * unnecessary, to enable switching font files without abandoning
  165.     X * their entries/info.
  166.     X */
  167.     Xstruct FINFO {
  168.     X    int f_numb;
  169.     X    /*
  170.     X     * 0 means not currently used, otherwise
  171.     X     * this is the position 'loaded' on
  172.     X     */
  173.     X    char f_name[30];    /* name.size */
  174.     X    struct c_param * f_chp;
  175.     X    /* really points to the first element in
  176.     X     * a 256 array of structs, so we can have
  177.     X     * the character info for all members of 
  178.     X     * this font without re-reading the file
  179.     X     */
  180.     X    FILE * f_ptr;
  181.     X}    finfo[NUMFONTS] = {
  182.     X    1,    "R.10",    NULL,    NULL,
  183.     X    2,    "B.10",    NULL,    NULL,
  184.     X    3,    "I.10",    NULL,    NULL,
  185.     X    4,        "",    NULL,    NULL,
  186.     X    5,        "",    NULL,    NULL,
  187.     X    6,        "",    NULL,    NULL,
  188.     X    7,        "",    NULL,    NULL,
  189.     X    8,        "",    NULL,    NULL
  190.     X};
  191.     X
  192.     XFILE *fp = stdin;    /* input file pointer */
  193.     X
  194.     X
  195.     Xmain(argc, argv)
  196.     Xchar *argv[];
  197.     X{
  198.     X    char buf[BUFSIZ];
  199.     X    int done();
  200.     X
  201.     X    setbuf(stdout, buf);
  202.     X    while (argc > 1 && argv[1][0] == '-') {
  203.     X        switch (argv[1][1]) {
  204.     X        case 'o':
  205.     X            outlist(&argv[1][2]);
  206.     X            break;
  207.     X        case 'd':
  208.     X            dbg = atoi(&argv[1][2]);
  209.     X            if (dbg == 0) dbg = 1;
  210.     X            break;
  211.     X        }
  212.     X        argc--;
  213.     X        argv++;
  214.     X    }
  215.     X
  216.     X    if (argc <= 1)
  217.     X        dofile(stdin);
  218.     X    else
  219.     X        while (--argc > 0) {
  220.     X            if (strcmp(*++argv, "-") == 0)
  221.     X                fp = stdin;
  222.     X            else if ((fp = fopen(*argv, "r")) == NULL)
  223.     X                error(FATAL, "can't open %s", *argv);
  224.     X            dofile(fp);
  225.     X            fclose(fp);
  226.     X        }
  227.     X    done();
  228.     X}
  229.     X
  230.     Xoutlist(s)    /* process list of page numbers to be printed */
  231.     Xchar *s;
  232.     X{
  233.     X    int start, finish, i;
  234.     X
  235.     X    pgindex = 0;
  236.     X    while (*s) {
  237.     X        for (start = 0; isdigit(*s); start = start * 10 +*s++ - '0');
  238.     X        finish = start;
  239.     X        if (*s == '-'){
  240.     X        s++;
  241.     X        for (finish = 0; isdigit(*s); finish = finish * 10 +*s++ - '0');
  242.     X        }
  243.     X        if (finish==0)    finish = 9999;
  244.     X
  245.     X        pagelist[pgindex++] = start;
  246.     X        pagelist[pgindex++] = finish;
  247.     X        if (*s != '\0')
  248.     X            s++;
  249.     X    }
  250.     X    pagelist[pgindex] = 0;
  251.     X    if (dbg)
  252.     X        for (i=0; i<pgindex; i += 2)
  253.     X            printf("%3d %3d\n", pagelist[i], pagelist[i+1]);
  254.     X}
  255.     X
  256.     Xin_olist(n)    /* is page n in pagelist? */
  257.     Xint n;
  258.     X{
  259.     X    int i;
  260.     X
  261.     X    if (pgindex == 0)
  262.     X        return(1);    /* everything is included */
  263.     X    for (i = 0; i < pgindex; i += 2)
  264.     X        if (n >= pagelist[i] && n <= pagelist[i+1])
  265.     X            return(1);
  266.     X    return(0);
  267.     X}
  268.     X
  269.     X
  270.     Xdofile(fp)
  271.     Xregister FILE *fp;
  272.     X{
  273.     X    register int c, k;
  274.     X    int m, n, n1, m1;
  275.     X    char str[100], buf[300];
  276.     X
  277.     X    while ((c = getc(fp)) != EOF) {
  278.     X        switch (c) {
  279.     X        case '\n':    /* when input is text */
  280.     X        case ' ':
  281.     X        case 0:        /* occasional noise creeps in */
  282.     X            break;
  283.     X        case '0': case '1': case '2': case '3': case '4':
  284.     X        case '5': case '6': case '7': case '8': case '9':
  285.     X            /* two motion digits plus a character */
  286.     X            hmot((c-'0')*10 + getc(fp)-'0');
  287.     X            put1(getc(fp));
  288.     X            break;
  289.     X        case 'c':    /* single ascii character */
  290.     X            put1(getc(fp));
  291.     X            break;
  292.     X        case 'C':    /* 'funny' character */
  293.     X            fscanf(fp, "%s", str);
  294.     X#ifdef DEBUG
  295.     X            dprintf(stderr, "%s", str);
  296.     X#endif
  297.     X            put1s(str);
  298.     X            break;
  299.     X        case 't':    /* straight text */
  300.     X            fgets(buf, sizeof(buf), fp);
  301.     X            t_text(buf);
  302.     X            break;
  303.     X        case 'D':    /* draw function - not done yet */
  304.     X            fgets(buf, sizeof(buf), fp);
  305.     X            switch (buf[0]) {
  306.     X            case 'l':    /* draw a line */
  307.     X                sscanf(buf+1, "%d %d", &n, &m);
  308.     X                drawline(n, m, ".");
  309.     X                break;
  310.     X            case 'c':    /* circle */
  311.     X                sscanf(buf+1, "%d", &n);
  312.     X                drawcirc(n);
  313.     X                break;
  314.     X            case 'e':    /* ellipse */
  315.     X                sscanf(buf+1, "%d %d", &m, &n);
  316.     X                drawellip(m, n);
  317.     X                break;
  318.     X            case 'a':    /* arc */
  319.     X                sscanf(buf+1, "%d %d %d %d", &n, &m, &n1, &m1);
  320.     X                drawarc(n, m, n1, m1);
  321.     X                break;
  322.     X            case '~':    /* wiggly line */
  323.     X                drawwig(buf+1);
  324.     X                break;
  325.     X            default:
  326.     X                error(FATAL, "unknown drawing function %s", buf);
  327.     X                break;
  328.     X            }
  329.     X            break;
  330.     X        case 's':
  331.     X            fscanf(fp, "%d", &n);    /* ignore fractional sizes */
  332.     X#ifdef DEBUG
  333.     X            dprintf(stderr, "%d", n);
  334.     X#endif
  335.     X            setsize(t_size(n));
  336.     X            break;
  337.     X        case 'f':
  338.     X            fscanf(fp, "%s", str);
  339.     X#ifdef DEBUG
  340.     X            dprintf(stderr, "%s", str);
  341.     X#endif
  342.     X            setfont(t_font(str));
  343.     X            break;
  344.     X        case 'H':    /* absolute horizontal motion */
  345.     X            while ((c = getc(fp)) == ' ')
  346.     X                ;
  347.     X            for (k = c-'0'; isdigit(c = getc(fp)); k = 10*k+c-'0');
  348.     X            ungetc(c, fp);
  349.     X            hgoto(k);
  350.     X            break;
  351.     X        case 'h':    /* relative horizontal motion */
  352.     X            while ((c = getc(fp)) == ' ')
  353.     X                ;
  354.     X            for (k = c-'0'; isdigit(c = getc(fp)); k = 10*k+c-'0');
  355.     X            ungetc(c, fp);
  356.     X            hmot(k);
  357.     X            break;
  358.     X        case 'w':    /* word space */
  359.     X            /* should either ignore this or space over
  360.     X            the right character width, not just space */
  361.     X            putc(' ', stdout);
  362.     X            break;
  363.     X        case 'V':
  364.     X            while ((c = getc(fp)) == ' ')
  365.     X                ;
  366.     X            for (n = c-'0'; isdigit(c = getc(fp)); n = 10*n+c-'0');
  367.     X            ungetc(c, fp);
  368.     X#ifdef DEBUG
  369.     X            dprintf(stderr, "%d", n);
  370.     X#endif
  371.     X            vgoto(n);
  372.     X            break;
  373.     X        case 'v':
  374.     X            while ((c = getc(fp)) == ' ')
  375.     X                ;
  376.     X            for (n = c-'0'; isdigit(c = getc(fp)); n = 10*n+c-'0');
  377.     X            ungetc(c, fp);
  378.     X#ifdef DEBUG
  379.     X            dprintf(stderr, "%d", n);
  380.     X#endif
  381.     X            vmot(n);
  382.     X            break;
  383.     X        case 'p':    /* new page */
  384.     X            fscanf(fp, "%d", &n);
  385.     X#ifdef DEBUG
  386.     X            dprintf(stderr, "%d", n);
  387.     X#endif
  388.     X            t_page(n);
  389.     X            break;
  390.     X        case 'n':    /* end of line */
  391.     X            while (getc(fp) != '\n')
  392.     X                ;
  393.     X            t_newline();
  394.     X            break;
  395.     X        case '#':    /* comment */
  396.     X            while (getc(fp) != '\n')
  397.     X                ;
  398.     X            break;
  399.     X        case 'x':    /* device control */
  400.     X            device(fp);
  401.     X            break;
  402.     X        default:
  403.     X            error(!FATAL, "unknown input character %o %c", c, c);
  404.     X            done();
  405.     X        }
  406.     X    }
  407.     X}
  408.     X
  409.     Xdevice(fp)    /* interpret device control functions */
  410.     XFILE *fp;
  411.     X{
  412.     X    char str[20];
  413.     X    int n;
  414.     X
  415.     X    fscanf(fp, "%s", str);
  416.     X#ifdef DEBUG
  417.     X    dprintf(stderr, "%s", str);
  418.     X#endif
  419.     X    switch (str[0]) {
  420.     X    case 'i':    /* initialize */
  421.     X        fileinit();
  422.     X        t_init(0);
  423.     X        break;
  424.     X    case 'T':    /* device name */
  425.     X        fscanf(fp, "%s", devname);
  426.     X#ifdef DEBUG
  427.     X        dprintf(stderr, "%s", devname);
  428.     X#endif
  429.     X        /* gets ignored anyway */
  430.     X        break;
  431.     X    case 't':    /* trailer */
  432.     X        t_trailer();
  433.     X        break;
  434.     X    case 'p':    /* pause -- can restart */
  435.     X        t_reset('p');
  436.     X        break;
  437.     X    case 's':    /* stop */
  438.     X        t_reset('s');
  439.     X        break;
  440.     X    case 'r':    /* resolution assumed when prepared */
  441.     X        fscanf(fp, "%d", &res);
  442.     X#ifdef DEBUG
  443.     X        dprintf(stderr, "%d", res);
  444.     X#endif
  445.     X        break;
  446.     X    case 'f':    /* font used */
  447.     X        fscanf(fp, "%d %s", &n, str);
  448.     X#ifdef DEBUG
  449.     X        dprintf(stderr, "%d %s", n, str);
  450.     X#endif
  451.     X        loadfont(n, str);
  452.     X        break;
  453.     X    }
  454.     X    while (getc(fp) != '\n')    /* skip rest of input line */
  455.     X        ;
  456.     X}
  457.     X
  458.     X
  459.     Xfileinit()    /* read in font and code files, etc. */
  460.     X{
  461.     X    /*
  462.     X     * don't do anything here since the first commands
  463.     X     * in any output from troff are font load commands and
  464.     X     * we'll do them there anyway
  465.     X     */
  466.     X}
  467.     X
  468.     Xfontprint(i)    /* debugging print of font i (1,...NUMFONTS) */
  469.     X{
  470.     X    /*
  471.     X     * I'm too lazy - add this if you want - it's just
  472.     X     * a simple loop, e.g for (i=0; i<256; call raster)
  473.     X     */
  474.     X}
  475.     X
  476.     Xloadcode(n, nw)
  477.     X/* load codetab on position n (0...NUMFONTS); #chars is nw */
  478.     X/* someday will get added when i discover where the tables */
  479.     X/* are, or if i create them from my font dumps.            */
  480.     Xint n, nw;
  481.     X{
  482.     X/*
  483.     X * do we know how the code tables are organized?
  484.     X * the code positions are different (of course ...) for vfont
  485.     X * and for the AT&T DWB fonts (the imagen rasters).
  486.     X * we need a way to distinguish between the raster files
  487.     X * not based on their names, and f_magic, as far as i remember,
  488.     X * is not consistent. either find a 'smart' way to do this, or
  489.     X * go over ALL the font files and force f_magic to 0436 for vfont
  490.     X * and to something else for rasti10. then we can have independent
  491.     X * code tables and add them to the FINFO structures, so that we
  492.     X * can find find a character FAST.
  493.     X * P.S. - i think the maxx, maxy, and xtend fields are ALWAYS 0 on
  494.     X * the rasti10 stuff, and ALWAYS initialized to something normal in
  495.     X * vfont, so that may be a solution.
  496.     X */
  497.     X}
  498.     X
  499.     Xcheat_size(n)
  500.     Xint n;
  501.     X{
  502.     X    register int * siz;
  503.     X    static int av_siz [] = {
  504.     X        6, 7, 8, 9, 10, 11, 12,
  505.     X        14, 16, 18, 20, 22, 24,
  506.     X        28, 36, 0
  507.     X    };
  508.     X
  509.     X    n = (int)(n*1.33);
  510.     X        /*
  511.     X         * is vfont for 200 dpi?
  512.     X         * this seems to give a good size ratio
  513.     X         * but can change to fit your mood ...
  514.     X         * it's not exact anyway cause of cheatsize().
  515.     X         */
  516.     X
  517.     X    for (siz=av_siz; (*siz != 0) && (n > *siz); siz++)
  518.     X        ;
  519.     X    return ((*siz == 0) ? *--siz : *siz);
  520.     X}
  521.     X
  522.     Xloadfont(pos, s)
  523.     X    /* load font info for font s on position n (1...NUMFONTS) */
  524.     Xint pos;
  525.     Xchar *s;
  526.     X{
  527.     X    /*
  528.     X     * read in a font here from the library - just the header
  529.     X     * and the c_param structures. we'll do an fseek and read
  530.     X     * for the characters separately.
  531.     X     * call t_fp to update the table of fonts and see if we
  532.     X     * already have the info we need, and check if not on cartridge.
  533.     X     *
  534.     X     * there should be
  535.     X     * space for more than one font since troff seems to enjoy
  536.     X     * changing point sizes on the fly ..
  537.     X     */
  538.     X
  539.     X    char    filename[100];
  540.     X    struct f_header   fh;
  541.     X    register int     i;
  542.     X    char tmpname[30];
  543.     X    struct c_param * chpalloc();
  544.     X
  545.     X#ifdef DEBUG
  546.     X    dinfoprint("loadfont entered");
  547.     X#endif
  548.     X    sprintf(tmpname, "%s.%d", s, want_siz);
  549.     X    i = t_fp(pos, tmpname);
  550.     X    if       ((strcmp(tmpname,"R.10")==0)
  551.     X        || (strcmp(tmpname,"I.10")==0)
  552.     X        || (strcmp(tmpname,"B.10")==0)) {
  553.     X                cartridge  = 1;
  554.     X                c_fnt_indx = i;
  555.     X                crnt_siz = want_siz;
  556.     X#ifdef DEBUG
  557.     X                dinfoprint("loadfont");
  558.     X#endif
  559.     X                return;
  560.     X    }
  561.     X    sprintf(tmpname, "%s.%d", s, cheat_size(want_siz));
  562.     X    /* 
  563.     X     * cheat with the size here. maybe should use
  564.     X     * (int)(want_siz/0.8) or (int)(want_siz/0.67)
  565.     X     * to compensate - check
  566.     X     * availability of these sizes b4 u try it
  567.     X     */
  568.     X        /* this is the font we want */
  569.     X    if (finfo[i].f_ptr != NULL){
  570.     X        /* found it, and the file has already been read */
  571.     X        cartridge  = 0;
  572.     X        c_fnt_indx = i;
  573.     X        crnt_siz = want_siz;
  574.     X#ifdef DEBUG
  575.     X        dinfoprint("loadfont");
  576.     X#endif
  577.     X        return;
  578.     X    }
  579.     X    /*
  580.     X     * found an entry, but it hasn't been read yet - alloc
  581.     X     * mem if needed, file gets read at end of else clause.
  582.     X     */
  583.     X    cartridge  = 0;
  584.     X    c_fnt_indx = i;
  585.     X    crnt_siz = want_siz;
  586.     X    if (finfo[c_fnt_indx].f_chp == NULL)
  587.     X        if ((finfo[c_fnt_indx].f_chp = chpalloc()) == NULL)
  588.     X            error(FATAL,"couldn't allocate memory");
  589.     X            /* does not return */
  590.     X    /*
  591.     X     * we now have a spot in finfo[c_fnt_indx]
  592.     X     * either because we found an entry that hasn't 
  593.     X     * been read in,
  594.     X     * or because we replaced an old entry. so now
  595.     X     * we read in the information from the font file.
  596.     X     */
  597.     X        
  598.     X
  599.     X    sprintf(filename, "%s/%s", dfltdir, tmpname);
  600.     X    finfo[c_fnt_indx].f_ptr = fopen (filename, "r");
  601.     X    if (finfo[c_fnt_indx].f_ptr == NULL) {
  602.     X        error (!FATAL, "font file - can't open %s", filename);
  603.     X        finfo[c_fnt_indx].f_name[0] = '\0';
  604.     X        c_fnt_indx = 0;
  605.     X#ifdef DEBUG
  606.     X        dinfoprint("loadfont");
  607.     X#endif
  608.     X        return;
  609.     X    }
  610.     X#ifdef DEBUG
  611.     X    dprintf (stderr, "font file %s\n", filename);
  612.     X#endif
  613.     X
  614.     X    fread (&fh, sizeof (struct f_header), 1, finfo[c_fnt_indx].f_ptr);
  615.     X    /*
  616.     X     * not used at the time. may need it later on since we have
  617.     X     * to distinguish between berkeley vfont and dwb rasti10
  618.     X     * files, so might stuff a different magic number and stick
  619.     X     * an indicator into the finfo structure.
  620.     X     */
  621.     X    fread (finfo[c_fnt_indx].f_chp,
  622.     X            sizeof (struct c_param), 256, finfo[c_fnt_indx].f_ptr);
  623.     X    crnt_siz = want_siz;
  624.     X#ifdef DEBUG
  625.     X    dinfoprint("loadfont");
  626.     X#endif
  627.     X}
  628.     X
  629.     X
  630.     X
  631.     X
  632.     Xchar    devname[20]    = "hp2686A";
  633.     X    /* (Laserjet) - not used anywhere */
  634.     Xint hpos, vpos;
  635.     X
  636.     Xt_init(reinit)    /* initialize device */
  637.     Xint reinit;
  638.     X{
  639.     X
  640.     X    fflush(stdout);
  641.     X    hpos = vpos = 0;
  642.     X}
  643.     X
  644.     Xt_page(n)    /* do whatever new page functions */
  645.     X{
  646.     X    hpos = vpos = 0;
  647.     X    if (output == 0) {
  648.     X        output = in_olist(n);
  649.     X        t_init(1);
  650.     X        return;
  651.     X    }
  652.     X    putpage();
  653.     X    fflush(stdout);
  654.     X}
  655.     X
  656.     Xputpage()
  657.     X{
  658.     X    putchar('\f');
  659.     X}
  660.     X
  661.     Xt_newline()    /* do whatever for the end of a line */
  662.     X{
  663.     X    putchar('\n');
  664.     X    /*
  665.     X     * not really needed, but good for breaking up
  666.     X     * output file (debugging, modifying).
  667.     X     */
  668.     X    hpos = 0;
  669.     X}
  670.     X
  671.     Xt_size(n)
  672.     Xint n;
  673.     X{
  674.     X    return(n);
  675.     X}
  676.     X
  677.     Xt_font(s)    /* convert string to internal font number */
  678.     Xchar *s;
  679.     X{
  680.     X    /* will have to choose which font to read
  681.     X    into the tables so be careful here */
  682.     X    return(atoi(s));
  683.     X}
  684.     X
  685.     Xt_text(s)    /* print string s as text */
  686.     Xchar *s;
  687.     X{
  688.     X    int c, wspc;
  689.     X    char str[100];
  690.     X
  691.     X    if (!output)
  692.     X        return;
  693.     X    while ((c = *s++) != '\n') {
  694.     X        if (c == '\\') {
  695.     X            switch (c = *s++) {
  696.     X            case '\\':
  697.     X            case 'e':
  698.     X                put1('\\');
  699.     X                break;
  700.     X            case '(':
  701.     X                str[0] = *s++;
  702.     X                str[1] = *s++;
  703.     X                str[2] = '\0';
  704.     X                put1s(str);
  705.     X                break;
  706.     X            }
  707.     X        } else {
  708.     X            put1(c);
  709.     X        }
  710.     X        wspc = crnt_siz*300./72.; /* an 'em's worth? */
  711.     X        hmot(wspc);
  712.     X    }
  713.     X}
  714.     X
  715.     Xt_reset(c)
  716.     X{
  717.     X
  718.     X    output = 1;
  719.     X    if (c == 's'){
  720.     X        printf("\033E");
  721.     X        t_page(9999);
  722.     X        }
  723.     X    fflush(stdout);
  724.     X}
  725.     X
  726.     Xt_trailer()
  727.     X{
  728.     X}
  729.     X
  730.     Xhgoto(n)
  731.     X{
  732.     X    hpos = n;    /* this is where we want to be */
  733.     X            /* before printing a character, */
  734.     X            /* have to make sure it's true */
  735.     X}
  736.     X
  737.     Xhmot(n)    /* generate n units of horizontal motion */
  738.     Xint n;
  739.     X{
  740.     X    hpos += n;
  741.     X}
  742.     X
  743.     Xhflush()    /* actual horizontal output occurs here */
  744.     X{
  745.     X    printf("\033&a%dH",hpos);
  746.     X}
  747.     X
  748.     Xvgoto(n)
  749.     X{
  750.     X    static int oldvpos = 0;
  751.     X
  752.     X    vpos = n;
  753.     X    if (vpos != oldvpos){
  754.     X        printf("\033&a%dV",vpos);
  755.     X        oldvpos = vpos;
  756.     X        }
  757.     X}
  758.     X
  759.     Xvmot(n)    /* generate n units of vertical motion */
  760.     Xint n;
  761.     X{
  762.     X    vgoto(vpos + n);    /* ignores rounding */
  763.     X}
  764.     X
  765.     Xput1s(s)    /* s is a funny char name */
  766.     Xchar *s;
  767.     X{
  768.     X    register int i, j;
  769.     X    register char *p;
  770.     X    extern char *asctab[];
  771.     X        /* is only good for the fonts on the cartridge
  772.     X         * need a codetable for the raster dumps.
  773.     X         */
  774.     X    extern char *spectab[];
  775.     X        /* names of chars on S font- index of name = index of
  776.     X         * c_param so easy to find raster map
  777.     X         */
  778.     X    static char prev[10] = "";
  779.     X    static int previ;
  780.     X    static char prevs[10] = "";
  781.     X    static int prevsi;
  782.     X    char tmpname[30];
  783.     X    int o_fnt_indx;
  784.     X    int o_cartridge;
  785.     X
  786.     X    if (!output)
  787.     X        return;
  788.     X
  789.     X#ifdef DEBUG
  790.     X    dinfoprint("put1s entered");
  791.     X#endif
  792.     X    if (strcmp(s, prev) != 0) {
  793.     X        previ = -1;
  794.     X        for (i = 0; asctab[i] != 0; i += 2)
  795.     X            if (strcmp(asctab[i], s) == 0) {
  796.     X                strcpy(prev, s);
  797.     X                previ = i;
  798.     X                break;
  799.     X            }
  800.     X    }
  801.     X    if (previ >= 0) {
  802.     X        hflush(); vgoto(vpos);
  803.     X        /*
  804.     X         * should only use this for the cartridge fonts, but since
  805.     X         * don't have a codetable yet for the rasters, use this
  806.     X         * anyway - it will come out in the wrong font and size
  807.     X         * but it's at least viewable.
  808.     X         */
  809.     X        for (p = asctab[previ+1]; *p; p++)
  810.     X            putc(*p, stdout);
  811.     X
  812.     X#ifdef DEBUG
  813.     X        dprintf(stderr,"ascii character %s, font is %s\n",
  814.     X                asctab[previ], finfo[c_fnt_indx].f_name);
  815.     X
  816.     X        dinfoprint("put1s");
  817.     X#endif
  818.     X        return;
  819.     X    } else
  820.     X        prev[0] = 0;
  821.     X
  822.     X
  823.     X    if (strcmp(s, prevs) != 0) {
  824.     X        prevsi = -1;
  825.     X        for (i = 0; i<128; i++)
  826.     X            if (strcmp(spectab[i], s) == 0) {
  827.     X                strcpy(prevs, s);
  828.     X                prevsi = i;
  829.     X                break;
  830.     X            }
  831.     X    }
  832.     X    if (prevsi >= 0) {
  833.     X        for (i=0; i<NUMFONTS; i++){
  834.     X            if (finfo[i].f_numb == 6) break;
  835.     X            }
  836.     X        if (i >= NUMFONTS) error(FATAL,"nothing mounted on position 6");
  837.     X        /* may add a s_fnt_indx to get around this */
  838.     X
  839.     X#ifdef DEBUG
  840.     X    dprintf(stderr,"special character %s, font on position 6 is %s\n",
  841.     X                spectab[prevsi], finfo[i].f_name);
  842.     X#endif
  843.     X
  844.     X        o_fnt_indx = c_fnt_indx;
  845.     X        o_cartridge = cartridge;
  846.     X
  847.     X        if ((p = index(finfo[i].f_name,'.'))==0)
  848.     X            error(FATAL,"finfo entry screwed up");
  849.     X
  850.     X        /* size check - may need new file */
  851.     X
  852.     X        if (atoi(++p)!=want_siz) {
  853.     X            for (j=0; (tmpname[j]=finfo[i].f_name[j])!='.' ;j++);
  854.     X            tmpname[j]='\0';
  855.     X            /* copy the font name up to the '.' into tmpname */
  856.     X
  857.     X            loadfont(finfo[i].f_numb, tmpname);
  858.     X            /* do a new load on position 6 for new size */
  859.     X            /* this will change c_fnt_indx and */
  860.     X            /* cartridge indicator, so need to restore. */
  861.     X            i = c_fnt_indx;
  862.     X
  863.     X#ifdef DEBUG
  864.     X        dprintf(stderr,
  865.     X            "put1s - needed size change, current font pos %d has %s\n",
  866.     X                finfo[c_fnt_indx].f_numb, finfo[c_fnt_indx].f_name);
  867.     X#endif
  868.     X        }
  869.     X        else {
  870.     X            /* 
  871.     X             * we didn't call loadfont since size was ok,
  872.     X             * but raster looks at c_fnt_indx to get a file
  873.     X             * pointer, so change it here and reset later.
  874.     X             * dirty, lousy code - redo this whole section
  875.     X             */
  876.     X             c_fnt_indx = i;
  877.     X        }
  878.     X
  879.     X#ifdef DEBUG
  880.     X        dinfoprint("put1s");
  881.     X#endif
  882.     X        raster(finfo[i].f_chp+prevsi);
  883.     X
  884.     X        cartridge = o_cartridge;
  885.     X        c_fnt_indx = o_fnt_indx;
  886.     X
  887.     X#ifdef DEBUG
  888.     X        dprintf(stderr,
  889.     X            "put1s - restored old font, position %d has %s\n",
  890.     X                finfo[c_fnt_indx].f_numb, finfo[c_fnt_indx].f_name);
  891.     X
  892.     X        dinfoprint("put1s");
  893.     X#endif
  894.     X        return;
  895.     X    } else
  896.     X        prevs[0] = 0;
  897.     X#ifdef DEBUG
  898.     X        dinfoprint("put1s");
  899.     X#endif
  900.     X}
  901.     X
  902.     X
  903.     Xput1(c)    /* output char c */
  904.     Xint c;
  905.     X{
  906.     X    register char * pt;    /* finds the size of the current font */
  907.     X
  908.     X    if (!output)
  909.     X        return;
  910.     X    vgoto(vpos);
  911.     X    /*
  912.     X    horiz position gets flushed if it's not a 
  913.     X    'nnc' sequence, in which case we try to let 
  914.     X    the laserjet handle the spacing
  915.     X    */
  916.     X    /*
  917.     X    Cancel the above - the laserjet's spacing is too
  918.     X    wide for troff. it doesn't look as nice either. while
  919.     X    this cuts file size & xmission time, we need a better
  920.     X    solution, i.e. width tables, etc.
  921.     X    */
  922.     X        hflush();
  923.     X
  924.     X    /*
  925.     X     * the following is SLOW and messy. find a better
  926.     X     * way of knowing what the size is. yuck.
  927.     X     */
  928.     X
  929.     X#ifdef DEBUG
  930.     X    dinfoprint("put1 entered");
  931.     X#endif
  932.     X
  933.     X    if ((pt = index(finfo[c_fnt_indx].f_name,'.'))==0)
  934.     X        error(FATAL,"finfo entry screwed up");
  935.     X
  936.     X    if (atoi(++pt)!=want_siz) {
  937.     X        /* copy the font name up to the '.' into tmpname */
  938.     X        setfont(finfo[c_fnt_indx].f_numb);
  939.     X            /* do a new load since we lost our size */
  940.     X
  941.     X#ifdef DEBUG
  942.     X        dprintf(stderr,
  943.     X            "put1 - needed size change, current font pos %d has %s\n",
  944.     X                finfo[c_fnt_indx].f_numb, finfo[c_fnt_indx].f_name);
  945.     X#endif
  946.     X    }
  947.     X
  948.     X#ifdef DEBUG
  949.     X    dinfoprint("put1");
  950.     X#endif
  951.     X    if (cartridge) putc(c, stdout);
  952.     X    else {
  953.     X        raster(finfo[c_fnt_indx].f_chp+c);
  954.     X        /* only good for vfont, dwb needs a code table */
  955.     X    }
  956.     X#ifdef DEBUG
  957.     X    dinfoprint("put1");
  958.     X#endif
  959.     X}
  960.     X
  961.     Xsetsize(n)    /* set point size to n (internal) */
  962.     Xint n;
  963.     X{
  964.     X#ifdef DEBUG
  965.     X    dprintf(stderr,"going to point size %d\n",n);
  966.     X#endif
  967.     X    want_siz = n;
  968.     X}
  969.     X
  970.     Xt_fp(n, s)    /* font position n now contains font s */
  971.     Xint n;
  972.     Xchar *s;    /* s is a name.size combination */
  973.     X{
  974.     X    register int ind;
  975.     X
  976.     X#ifdef DEBUG
  977.     X    dinfoprint("t_fp entered");
  978.     X#endif
  979.     X    for (ind = 0; ind < NUMFONTS; ind++){
  980.     X        if (finfo[ind].f_numb == n){
  981.     X            if (strcmp(finfo[ind].f_name, s)==0){
  982.     X#ifdef DEBUG
  983.     X                dinfoprint("t_fp");
  984.     X#endif
  985.     X                return(ind);    /* already there */
  986.     X                }
  987.     X            else {
  988.     X                strcpy(finfo[ind].f_name, s);
  989.     X                if (finfo[ind].f_ptr != NULL)
  990.     X                    fclose(finfo[ind].f_ptr);
  991.     X                finfo[ind].f_ptr = NULL;
  992.     X#ifdef DEBUG
  993.     X                dinfoprint("t_fp");
  994.     X#endif
  995.     X                return(ind);
  996.     X            }
  997.     X        }
  998.     X    }
  999.     X#ifdef DEBUG
  1000.     X    dinfoprint("t_fp");
  1001.     X#endif
  1002.     X    error(FATAL, "can't mount %s, pos %d doesn't exist", s, n);
  1003.     X    /* NOTREACHED */
  1004.     X}
  1005.     X
  1006.     Xsetfont(n)    /* set font to n */
  1007.     Xint n;
  1008.     X{
  1009.     X    register int ind;
  1010.     X    register char * pt;
  1011.     X    char tmpname[30];    /* just a convenience */
  1012.     X
  1013.     X#ifdef DEBUG
  1014.     X    dinfoprint("setfont entered");
  1015.     X    dprintf(stderr,"request for font on position %d\n",n);
  1016.     X#endif
  1017.     X
  1018.     X    for (ind = 0; ind < NUMFONTS; ind++){
  1019.     X            if (finfo[ind].f_numb == n) break;
  1020.     X            }
  1021.     X    if (ind >= NUMFONTS)
  1022.     X        error(FATAL, "nothing mounted on position %d", n);
  1023.     X
  1024.     X    c_fnt_indx = ind;
  1025.     X    crnt_siz = want_siz;
  1026.     X
  1027.     X    cartridge = 0;
  1028.     X
  1029.     X    /*
  1030.     X     * check the size of the mounted font and make
  1031.     X     * sure its what we want, otherwise call loadfont
  1032.     X     */
  1033.     X    if ((pt = index(finfo[c_fnt_indx].f_name,'.'))==0)
  1034.     X        error(FATAL,"finfo entry screwed up");
  1035.     X
  1036.     X    if (atoi(++pt)!=want_siz) {
  1037.     X        for (ind=0;
  1038.     X            (tmpname[ind]=finfo[c_fnt_indx].f_name[ind])!='.' ;ind++);
  1039.     X        tmpname[ind]='\0';
  1040.     X        /* copy the font name up to the '.' into tmpname */
  1041.     X        loadfont(finfo[c_fnt_indx].f_numb, tmpname);
  1042.     X            /* do a new load since we lost our size */
  1043.     X
  1044.     X#ifdef DEBUG
  1045.     X        dprintf(stderr,
  1046.     X        "setfont - needed size change, current font pos %d has %s\n",
  1047.     X                finfo[c_fnt_indx].f_numb, finfo[c_fnt_indx].f_name);
  1048.     X#endif
  1049.     X    }
  1050.     X
  1051.     X    strcpy(tmpname, finfo[c_fnt_indx].f_name);
  1052.     X    if (strcmp(tmpname,"R.10")==0){
  1053.     X        printf("\033&l0O\033(0U\033(s1p10v0s0b5T");
  1054.     X        /* Times Roman medium upright (portrait) */
  1055.     X        cartridge  = 1;
  1056.     X#ifdef DEBUG
  1057.     X    dprintf(stderr,"set font to %s\n", finfo[c_fnt_indx].f_name);
  1058.     X    dinfoprint("setfont");
  1059.     X#endif
  1060.     X        return;
  1061.     X    }
  1062.     X    if (strcmp(tmpname,"I.10")==0){
  1063.     X        printf("\033&l0O\033(0U\033(s1p10v1s0b5T");
  1064.     X        /* Times Roman medium italic (portrait) */
  1065.     X        cartridge  = 1;
  1066.     X#ifdef DEBUG
  1067.     X    dprintf(stderr,"set font to %s\n", finfo[c_fnt_indx].f_name);
  1068.     X    dinfoprint("setfont");
  1069.     X#endif
  1070.     X        return;
  1071.     X    }
  1072.     X    if (strcmp(tmpname,"B.10")==0) {
  1073.     X        printf("\033&l0O\033(0U\033(s1p10v0s1b5T");
  1074.     X        /* Times Roman bold upright (portrait) */
  1075.     X        cartridge  = 1;
  1076.     X#ifdef DEBUG
  1077.     X    dprintf(stderr,"set font to %s\n", finfo[c_fnt_indx].f_name);
  1078.     X    dinfoprint("setfont");
  1079.     X#endif
  1080.     X        return;
  1081.     X    }
  1082.     X
  1083.     X    if (finfo[c_fnt_indx].f_ptr==NULL) {
  1084.     X        for (ind=0;
  1085.     X            (tmpname[ind]=finfo[c_fnt_indx].f_name[ind])!='.' ;ind++);
  1086.     X        tmpname[ind]='\0';
  1087.     X        /* copy the font name up to the '.' into tmpname */
  1088.     X        loadfont(finfo[c_fnt_indx].f_numb, tmpname);
  1089.     X            /* do a new load since we lost our size */
  1090.     X
  1091.     X#ifdef DEBUG
  1092.     X        dprintf(stderr,
  1093.     X        "setfont - got a NULL fptr, current font pos %d has %s\n",
  1094.     X                finfo[c_fnt_indx].f_numb, finfo[c_fnt_indx].f_name);
  1095.     X#endif
  1096.     X    }
  1097.     X
  1098.     X#ifdef DEBUG
  1099.     X    dprintf(stderr,"set font to %s\n", finfo[c_fnt_indx].f_name);
  1100.     X    dinfoprint("setfont");
  1101.     X#endif
  1102.     X}
  1103.     X
  1104.     Xdone()
  1105.     X{
  1106.     X    output = 1;
  1107.     X    putpage();
  1108.     X    fflush(stdout);
  1109.     X    exit(0);
  1110.     X}
  1111.     X
  1112.     Xraster (chp)
  1113.     Xstruct c_param    * chp;
  1114.     X{
  1115.     X    int    height, width, bytewidth;
  1116.     X    int lsrres = 300;
  1117.     X    int    i, j;
  1118.     X    long    p;
  1119.     X    FILE * fp;    /* just a convenience */
  1120.     X
  1121.     X    if ((fp = finfo[c_fnt_indx].f_ptr)==NULL){
  1122.     X        /* fseek dumps core on a NULL file pointer */
  1123.     X        error(!FATAL,"raster: called with a NULL file pointer, %s",
  1124.     X                    "ignoring request");
  1125.     X        return;
  1126.     X    }
  1127.     X
  1128.     X    height = (int) ckint (chp->c_up) + (int) ckint (chp->c_down);
  1129.     X    width = (int) ckint (chp->c_left) + (int) ckint (chp->c_right);
  1130.     X    bytewidth = (width+7)/8;
  1131.     X
  1132.     X    if ((height*bytewidth)!=chp->c_size){
  1133.     X        /*
  1134.     X         * brain damage - system V and /usr/lib/vfont don't
  1135.     X         * agree on whether size is left+right or 1 bit bigger.
  1136.     X         * same for height (# of rows in bit map).
  1137.     X         *
  1138.     X         * change this thing to use f_magic somehow. (or the
  1139.     X         * presence/absence of normal numbers in maxx, maxy, etc
  1140.     X         */
  1141.     X        fprintf(stderr,
  1142.     X            "width & height don't match, trying rasti10 format ... ");
  1143.     X        width += 1;
  1144.     X        height += 1;
  1145.     X        bytewidth = (width+7)/8;
  1146.     X            if ((height*bytewidth)!=chp->c_size)
  1147.     X                fprintf(stderr, "FAILED - BAD FONT FILE\n");
  1148.     X            else
  1149.     X                fprintf(stderr, "ok\n");
  1150.     X    }
  1151.     X#ifdef DEBUG
  1152.     X    else dprintf(stderr, "width & height match\n");
  1153.     X#endif
  1154.     X
  1155.     X    p = F_OFFSET + chp->c_addr;
  1156.     X    if (fseek(fp, p, 0) == -1)
  1157.     X        error(FATAL, "seek failed on file %s offset %d",
  1158.     X                finfo[c_fnt_indx].f_name, p);
  1159.     X                /* does not return */
  1160.     X
  1161.     X#define    CNV(x)    ((int)((723./lsrres)*(x)))
  1162.     X
  1163.     X    vgoto (vpos - CNV(chp->c_up));
  1164.     X    hgoto (hpos + 24 - CNV(chp->c_left)); hflush();
  1165.     X    /*
  1166.     X     * the 24 is because the laserjet's letters are not
  1167.     X     * placed where troff thinks they are. they seem to be
  1168.     X     * in the lower left corner of the character cell instead of
  1169.     X     * at the baseline - probably need to adjust
  1170.     X     * the height too, but do that later.
  1171.     X     * Why 24? why not? got a better number?
  1172.     X     */
  1173.     X    printf ("\033*t%dR",lsrres);
  1174.     X    printf ("\033*r1A");
  1175.     X
  1176.     X    for (i = 0; i < height; i++) {
  1177.     X        if (p >= F_OFFSET + chp->c_addr + chp->c_size){
  1178.     X            error(!FATAL, "ran out of bit map data");
  1179.     X            /* does return, but don't fail in the middle
  1180.     X             * of an esc seqence - spit it out first, then
  1181.     X             * complain.
  1182.     X             */
  1183.     X            break;
  1184.     X        }
  1185.     X        printf ("\033*b%dW", (int) ((width + 7) / 8));
  1186.     X        for (j = 0; j < width; j += 8) {
  1187.     X            putchar (getc(fp));
  1188.     X            ++p;
  1189.     X        }
  1190.     X    }
  1191.     X    printf ("\033*rB");
  1192.     X    vgoto (vpos + CNV(chp->c_up));
  1193.     X    hgoto (hpos -24 + CNV(chp->c_left)); hflush();
  1194.     X}
  1195.     Xint     ckint (n)
  1196.     Xchar    n;
  1197.     X{
  1198.     X#ifdef u3b
  1199.     X    int     i;
  1200.     X    if ((int) n > 0177) {
  1201.     X        i = (int) n;
  1202.     X        i = (256 - i) * -1;
  1203.     X    }
  1204.     X    else {
  1205.     X        i = (int) n;
  1206.     X    }
  1207.     X    return (i);
  1208.     X#else
  1209.     X    return ((int) n);
  1210.     X#endif
  1211.     X}
  1212.     X
  1213.     Xdrawline(n, m, s) int n,m; char * s; {}
  1214.     Xdrawcirc(n) int n; {}
  1215.     Xdrawellip(m, n) int n,m; {}
  1216.     Xdrawarc(n, m, n1, m1) int n,m,n1,m1; {}
  1217.     Xdrawwig(buf) char * buf; {}
  1218.     X
  1219.     Xget1c(fp)
  1220.     XFILE * fp;
  1221.     X{
  1222.     X    register int c;
  1223.     X    c = getc(fp);
  1224.     X    fputc(c, stderr);
  1225.     X    return(c);
  1226.     X}
  1227.     Xstruct c_param *
  1228.     Xchpalloc()
  1229.     X{
  1230.     X    char * calloc();
  1231.     X    register int i;
  1232.     X    register struct c_param * tmptr;
  1233.     X
  1234.     X    /* give it 3 shots, otherwise die */
  1235.     X    for (i=0; i<3; i++){
  1236.     X        if ((tmptr=(struct c_param *)
  1237.     X                calloc(256, sizeof(struct c_param)))!=NULL)
  1238.     X                    return(tmptr);
  1239.     X    }
  1240.     X    return (tmptr);    /* NULL cast into right pointer */
  1241.     X}
  1242.     X
  1243.     Xerror(f, s, a1, a2, a3, a4, a5, a6, a7) {
  1244.     X    fprintf(stderr, "hp: ");
  1245.     X    fprintf(stderr, s, a1, a2, a3, a4, a5, a6, a7);
  1246.     X    fprintf(stderr, "\n");
  1247.     X    if (f)
  1248.     X        exit(1);
  1249.     X}
  1250.     X
  1251.     Xfinfoprint(m)
  1252.     Xchar * m;
  1253.     X{
  1254.     X    register struct FINFO * i;
  1255.     X
  1256.     X    fprintf(stderr, "%s: crnt_siz %d want_siz %d cartridge %d\n",
  1257.     X                m, crnt_siz, want_siz, cartridge);
  1258.     X    for (i=finfo; i < finfo + NUMFONTS; i++)
  1259.     X        fprintf(stderr, "pos %d name %30s chp %s fptr %s\n",
  1260.     X            i->f_numb, i->f_name, (i->f_chp ? "alloc" : "null"),
  1261.     X            (i->f_ptr ? "open" : "null"));
  1262.     X}
  1263. SHAR_EOF
  1264. if test 28471 -ne "`wc -c < 'hp.c'`"
  1265. then
  1266.     echo shar: error transmitting "'hp.c'" '(should have been 28471 characters)'
  1267. fi
  1268. fi # end of overwriting check
  1269. #    End of shell archive
  1270. exit 0
  1271.  
  1272.